<?php
class  globalModel{
	
	var $table='';
	
	function __construct(){
		$this->CI =getCI();
	}
	
	function _add($data){
		return $this->CI->db->insert(
			$this->table,
			$data
		);
	}
	
	function _update($par=array(), $data=array()){
		if(count($par) > 0 && count($data) > 0){
			return $this->CI->db->update(
				$this->table,
				$data, 
				$par
			);
		}else
			return false;
	}
	
	function _delete($par=array()){
		if(count($par) > 0){
			return $this->CI->db->delete($this->table,$par); 
		}else
			return false;
	}
	
	function _cek($par=array()){
		if(count($par) > 0){
			$m = $this->CI->db->get_where($this->table,$par);
			return $m->num_rows();
		}else
			return false;		
	}
	
	function _getall($par=array()){
		return  $this->CI->db->get_where($this->table,$par)->result();
	}
	
	function data_id($par=array()){
		if(count($par) > 0){
			return $this->CI->db->get_where(
				$this->table, 
				$par
			)->row();
		}else
			return false; 
	}
	
}
	
?>